package com.mdy.mq.consumer.service;

import com.mdy.mq.bean.Person;
import com.mdy.mq.consumer.modle.MqConstant;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Service;

/**
 * @author mengdy
 */
@Service
public class MqConsumerService {

    @RabbitListener(bindings = @QueueBinding(value = @Queue(value = MqConstant.DIRECT_QUEUE_NAME_2, durable = "true"),
            exchange = @Exchange(value = MqConstant.DIRECT_EXCHANGE_NAME_2, type = "direct", durable = "true"),
            key = MqConstant.DIRECT_KEY_NAME_2
    ))
    public void receive2(Person msg) {
        System.out.println("receive from "+ "  " + msg);
    }
}
